package net.vinote.smart.platform.module.alarm;

/**
 * 故障告警
 * 
 * @author Seer
 *
 */
public enum FaultAlarm {
	Event_Alarm_Service_Exception(AlarmCode.SERVICE_PROCESS_ERROR, "业务处理异常");

	private FaultAlarm(int code, String desc) {
		if ((code & FAULT_ALARM_TYPE) != FAULT_ALARM_TYPE
				|| (code & RECOVER_ALARM_TYPE) != RECOVER_ALARM_TYPE) {
			throw new IllegalArgumentException("invalid alarm code["
					+ this.name() + "]");
		}
		this.code = code;
		this.describe = desc;
	}

	/** 故障告警类型 */
	private static final int FAULT_ALARM_TYPE = 0x20000000;

	/** 故障已恢复告警类型 */
	private static final int RECOVER_ALARM_TYPE = 0x21000000;

	private int code;

	private String describe;

	public final int getCode() {
		return code;
	}

	public final String getDescribe() {
		return describe;
	}

	@Override
	public String toString() {
		return super.toString() + "[code: 0x" + Integer.toHexString(code)
				+ " ,describe: " + describe + "]";
	}

}
